
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>zookeeper是什么 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>zookeeper是什么 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">概念</div>
          <div class="card-question">什么是ZNode？它在Zookeeper中扮演什么角色？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">概念</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">ZNode是Zookeeper中的一个节点，Zookeeper使用类似文件系统的树状结构来组织数据。每个ZNode可以存储数据和子节点，形成一个层次化的目录结构。</div>
          </div>
          <div class="card-source">来源: 文档中「1. Zookeeper 的基本概念」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Zookeeper中的“Watcher”机制是什么，其主要功能是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zookeeper提供了Watcher机制，用于监听ZNode的变化事件。客户端可以注册Watcher，当ZNode的数据或结构发生变化时，Zookeeper会触发事件并通知客户端。</div>
          </div>
          <div class="card-source">来源: 文档中「7. Zookeeper 的 Watcher 机制」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Zookeeper数据模型中的ZNode分为哪两种主要类型？它们之间最关键的区别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">ZNode分为持久节点和临时节点。关键区别在于：持久节点在客户端断开连接后依然存在，除非被显式删除；而临时节点与客户端会话绑定，当客户端断开连接时会自动被删除。</div>
          </div>
          <div class="card-source">来源: 文档中「4. Zookeeper 的数据模型」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在Zookeeper集群中，“Leader”和“Follower”各自的角色和职责是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Leader负责处理写请求和事务日志。Follower负责处理读请求，并将写请求转发给Leader。</div>
          </div>
          <div class="card-source">来源: 文档中「3. Zookeeper 的核心组件」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Zookeeper是如何实现分布式锁的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zookeeper通过创建和删除临时节点来实现分布式锁的获取和释放，这用于解决分布式系统中的资源竞争问题，确保只有一个客户端可以获得锁。</div>
          </div>
          <div class="card-source">来源: 文档中「2. Zookeeper 的核心功能」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Zookeeper使用什么协议来保证数据一致性和高可用性？该协议包含哪些核心机制？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zookeeper使用ZAB协议（Zookeeper Atomic Broadcast）。该协议包括选举算法、数据广播和恢复机制。</div>
          </div>
          <div class="card-source">来源: 文档中「6. Zookeeper 的选举机制」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">应用</div>
          <div class="card-question">Zookeeper如何被用作集中式配置管理服务？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">应用</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">配置数据可以存储在Zookeeper的ZNode中，客户端可以读取和修改这些配置。同时，Zookeeper的Watcher机制可以自动通知客户端配置的变更。</div>
          </div>
          <div class="card-source">来源: 文档中「2. Zookeeper 的核心功能」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Zookeeper保证了哪种级别的数据一致性？它通过哪些方式来实现这种保证？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Zookeeper保证强一致性，即所有客户端看到的数据是一致的。它通过使用原子性操作和一致性协议（如ZAB协议）来确保数据一致性。</div>
          </div>
          <div class="card-source">来源: 文档中「5. Zookeeper 的一致性和可靠性」部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">Zookeeper的数据版本特性是如何支持条件修改操作的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">每个ZNode都有一个数据版本号，用于跟踪数据的修改。客户端在读取数据时可以指定版本号，从而实现条件修改（CAS）。</div>
          </div>
          <div class="card-source">来源: 文档中「4. Zookeeper 的数据模型」部分</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
